{include file="/sum/common/script" /}

<div id="addEdit" class="faq-form" v-cloak>
    <el-container class="panel-block">
        <el-main>
            <el-scrollbar height="100%">
                <el-form :model="form.model" :rules="form.rules" ref="formRef" label-width="100px">
                    <el-form-item label="标题" prop="title">
                        <el-input class="sa-w-360" v-model="form.model.title" placeholder="请输入标题"></el-input>
                    </el-form-item>

                    <el-form-item label="多语言" prop="lang">
                        <div class="sa-w-360">
                            <el-select v-model="form.model.lang" placeholder="请选择语言">
                                <el-option v-for="item in type.data.lang" :key="item.type" :label="item.name"
                                           :value="item.type"></el-option>
                            </el-select>
                        </div>
                    </el-form-item>

                    <el-form-item label="分类" prop="category_ids">
                        <div class="sa-w-360">
                            <el-select v-model="form.model.category_ids" placeholder="请选择分类" multiple>
                                <el-option v-for="item in category.select" :key="item.id" :label="item.name" :value="item.id"></el-option>
                            </el-select>
                            {if $auth->check('sum/category/add')}
                            <el-button class="label-tip" type="primary" link @click="onAddCategory">
                                添加分类
                            </el-button>
                            {/if}
                        </div>
                    </el-form-item>

                    <el-form-item label="封面" prop="image">
                        <sa-uploader v-model="form.model.image" type="size" @success="onSuccess"></sa-uploader>
                        <div class="warning"> 建议尺寸：750*750 px </div>
                    </el-form-item>

                    <el-form-item label="描述" prop="description">
                        <el-input class="sa-w-360" type="textarea" v-model="form.model.description" placeholder="请输入描述">
                        </el-input>
                    </el-form-item>

                    <el-form-item label="整剧价格" prop="price">
                        <el-input class="sa-w-360" v-model="form.model.price" placeholder="请输入整剧价格" type="number">
                            <template #append>金币</template>
                        </el-input>
                    </el-form-item>

                    <el-form-item label="总集数" prop="episodes_num">
                        <el-input class="sa-w-360" v-model="form.model.episodes_num" placeholder="请输入总集数" type="number">
                            <template #append>集</template>
                        </el-input>
                    </el-form-item>

                    <el-form-item label="评分" prop="rating">
                        <el-input class="sa-w-360" v-model="form.model.rating" placeholder="请输入评分" min="0" max="10" step="0.1" type="number">
                        </el-input>
                    </el-form-item>

                    <el-form-item label="排序" prop="weigh">
                        <el-input class="sa-w-360" v-model="form.model.weigh" placeholder="请输入排序" type="number">
                        </el-input>
                        <div class="warning"> 排序的大小默认按照从大到小排列 </div>
                    </el-form-item>

                    <el-form-item label="状态" required>
                        <el-radio-group v-model="form.model.status">
                            <el-radio label="up">上架</el-radio>
                            <el-radio label="down">下架</el-radio>
                        </el-radio-group>
                    </el-form-item>
                </el-form>
            </el-scrollbar>
        </el-main>
        <el-footer class="sa-footer--submit sa-flex sa-row-right">
            <el-button type="primary" @click="onConfirm">确定</el-button>
        </el-footer>
    </el-container>
</div>